#!/usr/bin/env python
#-*-coding:utf-8-*-

import os, sys
import speech

config_path = os.environ["HOME"]+"/.cyklory/config"

def read_config():
  """Read configuration file"""
  global ui
  f = open(config_path, 'r')
  r = f.read().split('\n')
  for l in r:
    if len(l) > 0:
      p = l.split('=')
      globals()[p[0]] = p[1]
  f.close()

read_config()


# UI core loading.
exec compile("from "+ui+"core import *", "<string>", "exec")
  
def main():
  sd = speech.Espeak()
  exec compile("uicore = Core"+ui+"(sd)", "<string>", "exec")
  
if __name__ == "__main__":
  main()
